package com.miaoshare.app.mvp.presenter;

import com.miaoshare.app.mvp.model.MainModel;
import com.miaoshare.app.mvp.model.UserBean;
import com.miaoshare.app.mvp.model.UserInfoEntity;
import com.miaoshare.app.mvp.view.MainView;
import com.miaoshare.core.base.BasePresenter;
import com.miaoshare.core.net.HttpListener;

import rx.functions.Action1;
import timber.log.Timber;

/**
 * Created by HeroSun
 * date 2022-02-14
 **/
public class MainPresenter extends BasePresenter<MainView> {

    public MainPresenter() {
        mModel = new MainModel();
    }

    public void login(String userName, String passWord) {
        //模拟登陆接口
        ((MainModel) mModel).login(userName, passWord, new HttpListener() {
            @Override
            public void onSuccess(Object object) {
                getBaseView().loginSuccess(0,(UserInfoEntity)object);
            }

            @Override
            public void onError(String errorMsg, String code) {

                getBaseView().onLoginError(errorMsg);
            }
        });
    }
}
